import 'package:one_flutter/MyCardView.dart';
import 'package:one_flutter/MyListview.dart';
import 'package:one_flutter/Product.dart';
import 'package:one_flutter/StackWidget.dart';
import 'CloumnWidget.dart';
import 'MyAppBar.dart';
import 'MyGrideView.dart';
import 'ReturnData.dart';
import 'RowWidget.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(new MaterialApp(home: MyDemo()));
}

class MyDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: new AppBar(
        title: new Text('flutter 基本控件使用'),
      ),
      body: new Column(
        children: [
          new Row(
            children: [
              Expanded(
                child: new RaisedButton(
                  onPressed: () {
                    // ignore: missing_return
                    Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (BuildContext context) => MyApp()));
                  },
                  child: new Text('textView image使用'),
                ),
              ),
              Expanded(
                child: new RaisedButton(
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (BuildContext context) {
                      return horieadListView();
                    }));
                  },
                  child: new Text('横向listview使用'),
                ),
              ),
            ],
          ),
          new Row(
            children: [
              Expanded(
                child: new RaisedButton(
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (BuildContext context) {
                      return bindDataListView(
                          itemss: new List<String>.generate(
                              1000, (index) => "item $index"));
                    }));
                  },
                  child: new Text('纵向listview绑定数据'),
                ),
              ),
              Expanded(
                child: new RaisedButton(
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (BuildContext context) {
                      return MyGrideView();
                    }));
                  },
                  child: new Text('grideview使用'),
                ),
              ),
            ],
          ),
          new Row(
            children: [
              Expanded(
                child: new RaisedButton(
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (BuildContext context) {
                      return MyRowwidget1();
                    }));
                  },
                  child: new Text('水平布局使用'),
                ),
              ),
              Expanded(
                child: new RaisedButton(
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (BuildContext context) {
                      return cloumnWidget();
                    }));
                  },
                  child: new Text('垂直布局使用'),
                ),
              ),
            ],
          ),
          new Row(
            children: [
              Expanded(
                  child: new RaisedButton(
                onPressed: () {
                  Navigator.push(context,
                      MaterialPageRoute(builder: (BuildContext context) {
                    return MyStackWidet();
                  }));
                },
                child: new Text('stack布局'),
              )),
              Expanded(
                  child: new RaisedButton(
                onPressed: () {
                  Navigator.push(context,
                      MaterialPageRoute(builder: (BuildContext context) {
                    return MyCard();
                  }));
                },
                child: new Text('card使用'),
              ))
            ],
          ),
          new Row(
            children: [
              Expanded(
                child: RaisedButton(
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (BuildContext context) {
                      return ProductList();
                    }));
                  },
                  child: Text("页面参数传递"),
                ),
              ),
              Expanded(
                child: RaisedButton(
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (BuildContext context) {
                          return RouteButton();
                        }));
                  },
                  child: Text("页面数据回传"),
                ),
              )
            ],
          )
        ],
      ),
    );
  }
}

/**
 * dart：text image 使用，及属性
 * */
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CommonBar(title: 'flutter text image 使用'),
      body: new Column(
        children: [
          Container(
            child: Text(
              'hellow world,flutter text 使用,text使用测试测试试测试试测试试测试试测试试测试',
              textAlign: TextAlign.left,
              maxLines: 1,
              overflow: TextOverflow.ellipsis,
              style: TextStyle(
                  fontSize: 25.0,
                  color: Color.fromARGB(255, 255, 124, 215),
                  decoration: TextDecoration.underline,
                  decorationStyle: TextDecorationStyle.solid),
            ),
          ),
          Container(
            child: new Image.network(
              'https://image.uisdc.com/wp-content/uploads/2019/05/material-dark-theme-1.jpg',
              //图片重复模式
              repeat: ImageRepeat.repeat,
              //图片混合模式
              color: Colors.blue,
              colorBlendMode: BlendMode.multiply,
              //设置图片展示样式
              fit: BoxFit.scaleDown,
            ),
            width: 300.0,
            height: 200.0,
            color: Colors.greenAccent,
          ),
          Container(
            child: new Text('hello world', style: TextStyle(fontSize: 40.0)),
            alignment: Alignment.topLeft,
            width: 500.0,
            height: 400.0,
//            color: Colors.blue,
            padding: const EdgeInsets.fromLTRB(10.0, 30.0, 0.0, 0.0),
            margin: const EdgeInsets.all(10.0),
            //线性渐变
            decoration: new BoxDecoration(
                gradient: const LinearGradient(colors: [
                  Colors.lightBlue,
                  Colors.greenAccent,
                  Colors.purple
                ]),
                //边框
                border: Border.all(width: 2.0, color: Colors.black)),
          )
        ],
      ),
    );
  }
}
